package com.ycc.springcloud.service.impl;


import com.ycc.springcloud.mapper.usermapper;
import com.ycc.springcloud.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

@Service
public class userservice {
    @Autowired
    public com.ycc.springcloud.mapper.usermapper usermapper;
    public  void  insert(String username,String password) {
        String encode = new BCryptPasswordEncoder().encode(password);
        usermapper.insert(new User(username,encode,"1"));
    }

    public User selectUserByUsername(String username){
        return usermapper.selectByUsername(username);
    }



}
